﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Platform.Storage.Redis
{
	public sealed class RedisServerCommands : RedisCommandsBase
	{

		internal RedisServerCommands( RedisMessageChannel channel )
			: base( channel )
		{ }


		public void ChangeDatabase( int dbid )
		{
			this.Channel.ExecuteSingle( "SELECT", dbid.ToString() );
		}

		public bool Ping()
		{
			return this.Channel.ExecuteSingle( "PING" ) == "PONG";
		}

		public void Quit()
		{
			this.Channel.ExecuteSingle( "QUIT" );
		}

		public long DbSize()
		{
			return this.Channel.ExecuteInt64( "DBSIZE" );
		}

		public void FlushAll()
		{
			this.Channel.ExecuteSingle( "FLUSHALL" );
		}
	}

}
